﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XYAuto.MonitorData.Chitunion.Bll.Email;
using XYAuto.MonitorData.Chitunion.Bll.MonitorNotice.Interface;
using XYAuto.MonitorData.Chitunion.Infrastruct.Verification;

namespace XYAuto.MonitorData.Chitunion.Bll.MonitorNotice
{
    public class SendByEmailProvider : AbstractNotices
    {
        public SendByEmailProvider(SendDto sendDto) : base(sendDto)
        {
        }

        public override ReturnValue Send()
        {
            var retValue = VerifySendDto();
            if (retValue.HasError)
                return retValue;
            var spUser = SendDto.ToUser.Split(',');
            EmailHelper.Instance.SendErrorMail(SendDto.Body, SendDto.Subject, spUser);

            DoAddNoticeLog(spUser.ToList());

            return retValue;
        }

    }
}
